<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>kindEditor</title>
    <link rel="stylesheet" href="themes/default/default.css"/>
    <link rel="stylesheet" href="plugins/code/prettify.css"/>
    <script charset="utf-8" src="kindeditor-all.js"></script>
    <script charset="utf-8" src="lang/zh-CN.js"></script>
    <script charset="utf-8" src="plugins/code/prettify.js"></script>
</head>
<body>
<textarea name="content1" cols="100" rows="8" style="width:90%;margin-left:5%;height:200px;visibility:hidden;"
          id="editor_id"></textarea>
</body>

<script type="text/javascript">
    KindEditor.ready(function (K) {
        window.editor = K.create('#editor_id');

        var uploadbutton = KindEditor.uploadbutton({
            button: KindEditor("fileupload")[0],
            fieldName: "fileupload",
            url: "http://42.51.40.208/upload/upload3",
            afterUpload: function (data) {
                if (data.error == 0) {
                    //data.url 处理
                } else {
                    alert("error");
                }
            },
            afterError: function (str) {
                //alert('error: ' + str);
            }
        });
        uploadbutton.fileBox.change(function (e) {
            uploadbutton.submit();
        });
    });
</script>
</html>